﻿package config;

import java.io.FileWriter;
import java.io.IOException;

/* *
 *类名：AlipayConfig
 *功能：基础配置类
 *详细：设置帐户有关信息及返回路径
 *修改日期：2017-04-05
 *说明：
 *以下代码只是为了方便商户测试而提供的样例代码，商户可以根据自己网站的需要，按照技术文档编写,并非一定要使用该代码。
 *该代码仅供学习和研究支付宝接口使用，只是提供一个参考。
 */

public class AlipayConfig {
	
//↓↓↓↓↓↓↓↓↓↓请在这里配置您的基本信息↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓

	// 应用ID,您的APPID，收款账号既是您的APPID对应支付宝账号
	public static String app_id = "2016092900620129";
	
	// 商户私钥，您的PKCS8格式RSA2私钥
    public static String merchant_private_key = "MIIEvgIBADANBgkqhkiG9w0BAQEFAASCBKgwggSkAgEAAoIBAQDoJLDEcbHzABB+NV5Zzjnhq6b28pz7QHPp6T70kwXZmEzKdCk4O3/EVfH5W+lI1Zb2LKYI3MyuQRFduE0VyRIxbEdXKzpJhjIOLfX2gcsekVxmeyZQrmRWzhxizURpal1tdM7ru5Ii5L/vBnuN3GSZnD8dHw8vwoHSgr0IO68jSB2ToSqHDrIvNZ1qDKJkMDb7rGiYgT+5eqr7VVIgyUWwoeih4GzqJYl4SsY7fpvFvKY4V7sJebv2T4fE4L+tRyo1teGhDGPNqcNui9LdBZ3lW+nUOlY1w/3fyAadhvHIQv+d+8pc+5E99clN7QsikNapMgNEt7if6Cfo1CF0PWX/AgMBAAECggEBAOIDBs7bWsMZJvWZhBivPY9HDbGUF95OrAvqeM6pbaKiMvFREuialRRUENgT8hZlTSqz4ZrzTZvB4eR7ESHKt5nCr9pgTclTi9xeRwAO8fD62Rk1gOJAR5Rz6xMOgjKXygpNFUBRSEAMsglHKHe/QXqEsrXpjWGUX8zSWLRxV1xieK7qPnrZsFS7kxYvyXf9j4aOSN/+88wf29YVyahgMt/s8BnUw4sgQE3OHU6bRzP0G/tc+1/GMIJtMmLWSYg6FBhgJ5dISP8DVLiiXos8iabwxYJLpL1L+cY0+SB0qYUjYplVxSJoCynS54rOcqYCO+1QG3Do1FOUK6kNUq43yvECgYEA/vGnDuFs2ogB2S2jPwj/4DEomlzbKj8AmGXpbw6g2eXXmdjZpAymur977D++SWmpXO8egrbpOHdKVfyAAFWnqlwWurKqpa8vh+f+Ni2//5gz4ZP6R0opJjrNsz2yiML6KLkgm3C+gAbt/JqxQ9v0XFCfFTsQuZ78hbvIPRcGDFMCgYEA6RrcFVn+htB83F/Fd/asCTIFeRHZyyD1eIZgmQmxW/GQhkU3KnEB3v645ofSThPoRrJAAXDuKAhPQ4QvPGIcxhv3PkSm3PF72LK7EKt42655QrpcGWFZ1UChc3EbYKDEqfBWZyYGZjWJpMvcNf5dXerp1IpUTO0ZLr/KlUlIKiUCgYBjpfC2UEZL5H1UdhIowUvCRXSpYUII8Tc6Whsz3XPht4TeDXSEOq2wsMevP/sQlswsFwrF7NibyYS0t00Q1GoEnJoFv3AT8rWRWYxzgM5bCRK+SSi6VLJgzvs35BW0fwFoiXPFTfwn7o12/r/q1j5dFuYXVk7jPtFVNGDAAA/NIQKBgQCrMrLYa5PnZ0+MejoI9P08c6RZWqbd7ILb1bU0ME41/J/sPQFbBkwdfm5FwRLPjQdWhKtFY69Fb3TnXTlj25rOVNOsw7bZJfGTIREKGSVWEjm0rDHf4gOb/y+UHUnCGdDWDlEmyGKCxmckxSQh84KW62R4WG+5X5jTIMCkC4IYkQKBgGqPp3DGYd+P/bm8sZ/pO41sEvopuhle/6hWhayi7HCdSEpLrHyMm8c8iHGr+qQWE8PGwqHyNwMSWS4zPpN4+9615cqRGBw84wOoCaNdtrIzxgvDzxHxovN8oBCa4/vxX9ru2XJgWyLXaOmRYV7AocWzeVw0Lf0YbBE4DwcGsboM";
	
	// 支付宝公钥,查看地址：https://openhome.alipay.com/platform/keyManage.htm 对应APPID下的支付宝公钥。
    public static String alipay_public_key = "MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAidi/NpJlqt7jbYvMaKNTASMncOHHSn0WxzL9JF/Q9+KwFxE9hvJhY/X24Ox+ihcIQGeoh7Pm0pQASPRTFmnj30glXx13JvJDR7Ir/udDPiuPD0J2AGCs6SPCeddUJ1+aUSYNeOLNy0M3sSKxOiHN9qd3foDHPNrAHOKTfWCudG+3nkEqau89MQo7PjvHaCFJ4LlKtNQ4Ijc+j5z+X6Gh+Qaf3Chj8uGudvDegT1plvyed8ZGXDLcGgp9IpyVR6rWh1z26q/ZAYzUWEkd9nk+ZZxiqB4FF4evN7/rCGH4TW+/wkiJzqczePIim0hKpvHt9xNpk1BegJ/GACdKM6LQMQIDAQAB";

	// 服务器异步通知页面路径  需http://格式的完整路径，不能加?id=123这类自定义参数，必须外网可以正常访问
	public static String notify_url = "http://localhost:8080/hos/notify_url.jsp";
	
	// 页面跳转同步通知页面路径 需http://格式的完整路径，不能加?id=123这类自定义参数，必须外网可以正常访问
	public static String return_url = "http://localhost:8080/hos/yiyuan.jsp";

	// 签名方式
	public static String sign_type = "RSA2";
	
	// 字符编码格式
	public static String charset = "utf-8";
	
	// 支付宝网关
	public static String gatewayUrl = "https://openapi.alipaydev.com/gateway.do";
			 
	// 支付宝网关
	public static String log_path = "C:\\";


//↑↑↑↑↑↑↑↑↑↑请在这里配置您的基本信息↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑

    /** 
     * 写日志，方便测试（看网站需求，也可以改成把记录存入数据库）
     * @param sWord 要写入日志里的文本内容
     */
    public static void logResult(String sWord) {
        FileWriter writer = null;
        try {
            writer = new FileWriter(log_path + "alipay_log_" + System.currentTimeMillis()+".txt");
            writer.write(sWord);
        } catch (Exception e) {
            e.printStackTrace();
        } finally {
            if (writer != null) {
                try {
                    writer.close();
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
        }
    }
}

